import Vue from "vue";
import Router from "vue-router";

Vue.use(Router)

const routerPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;
Router.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(error => error)
}
Router.prototype.replace = function replace(location) {
    return originalReplace.call(this, location).catch(err => err)
}

export default new Router({
    mode:"history",
    routes:[{
        path:"/",
        name:"index",
        component:()=>import("@/views/index.vue"),
        redirect:"/home",
        children:[
            {
                path:"/home",
                name:"home",
                component:()=>import("@/views/home.vue")
            },{
                path:"/footer",
                name:"footer",
                component:()=>import("@/views/footer.vue")
            },{
                path:"/indexdb",
                name:"indexdb",
                component:()=>import("@/views/indexeddb")
            }
        ]
    }]
})